﻿@page "/login"
@using BlazorWasm.JwtAuthLearning.Services
@inject IAccountService _accountService;
@inject NavigationManager _navigationManager;
<h3>Login</h3>
<div>
    <div class="form-group">
        <label for="inputEmail">Email Address</label>
        <input type="email"  class="form-control" id="inputEmail" @bind="@loginModel.Email"/>
    </div>
    <div class="form-group">
        <label for="inputPassword">Password</label>
        <input type="password" class="form-control" id="inputPassword" @bind="@loginModel.Password"/>
    </div>
    <button type="button" class="btn btn-primary" @onclick="LoginUser">Login</button>
</div>

@code {
    private LoginModel loginModel = new LoginModel();

    private async Task LoginUser()
    {
        bool result = false; //await _accountService.LoginAsync(loginModel);
        if (result)
        {
            _navigationManager.NavigateTo("/dashboard");
        }
    }
}
